﻿using SqlSugar;
using System.Linq.Expressions;

namespace A.M.Joint_Search
{
    public interface IBaseOrmRepository
    {
        /// <summary>
        /// 两表联查
        /// </summary>
        /// <typeparam name="T1">第一个表</typeparam>
        /// <typeparam name="T2">第二个表</typeparam>
        /// <typeparam name="T">返回的表</typeparam>
        /// <param name="t1s">第一个表</param>
        /// <param name="tls1">第二个表</param>
        /// <param name="expression">查询条件</param>
        /// <returns>两表联查</returns>
        //List<T> Joint_search<T1, T2, T>(List<T1> t1s, List<T2> t2s, Expression<Func<T1, T2, bool>> expression);

        /// <summary>
        /// 三表联查
        /// </summary>
        /// <typeparam name="T1">第一个表</typeparam>
        /// <typeparam name="T2">第二个表</typeparam>
        /// <typeparam name="T3">第三个表</typeparam>
        /// <typeparam name="T">返回的表</typeparam>
        /// <param name="t1s">第一个表</param>
        /// <param name="t2s">第二个表</param>
        /// <param name="t3s">第三个表</param>
        /// <param name="expression">查询条件</param>
        /// <returns>两表联查</returns>
        //List<T> Joint_search<T1, T2, T3, T>(List<T1> t1s, List<T2> t2s, List<T3> t3s, Expression<Func<T1, T2, T3, bool>> expression);

        /// <summary>
        /// 三表联查
        /// </summary>
        /// <typeparam name="T1">第一个表</typeparam>
        /// <typeparam name="T2">第二个表</typeparam>
        /// <typeparam name="T3">第三个表</typeparam>
        /// <typeparam name="T4">第四个表</typeparam>
        /// <typeparam name="T">返回的表</typeparam>
        /// <param name="t1s">第一个表</param>
        /// <param name="t2s">第二个表</param>
        /// <param name="t3s">第三个表</param>
        /// <param name="t4s">第四个表</param>
        /// <param name="expression">查询条件</param>
        /// <returns>两表联查</returns>
        //List<T> Joint_search<T1, T2, T3, T4, T>(List<T1> t1s, List<T2> t2s, List<T3> t3s, List<T4> t4s, Expression<Func<T1, T2, T4, bool>> expression);

        /// <summary>
        /// 三表联查
        /// </summary>
        /// <typeparam name="T1">第一个表</typeparam>
        /// <typeparam name="T2">第二个表</typeparam>
        /// <typeparam name="T3">第三个表</typeparam>
        /// <typeparam name="T4">第四个表</typeparam>
        /// <typeparam name="T5">第五个表</typeparam>
        /// <typeparam name="T">返回的表</typeparam>
        /// <param name="t1s">第一个表</param>
        /// <param name="t2s">第二个表</param>
        /// <param name="t3s">第三个表</param>
        /// <param name="t4s">第四个表</param>
        /// <param name="t5s">第四个表</param>
        /// <param name="expression">查询条件</param>
        /// <returns>两表联查</returns>
        //List<T> Joint_search<T1, T2, T3, T4, T5, T>(List<T1> t1s, List<T2> t2s, List<T3> t3s, List<T4> t4s, List<T5> t5s, Expression<Func<T1, T2, T4, T5, bool>> expression);


        /// <summary>
        /// 两表查询，
        /// </summary>
        /// <typeparam name="T1">左表</typeparam>
        /// <typeparam name="T2">右表</typeparam>
        /// <param name="joinExp">联表方式，联表字段（主外键关系）</param>
        /// <param name="selectExp">联表查询的结果</param>
        /// <param name="isWhere">是否需要查询条件</param>
        /// <param name="whereExp">条件查询</param>
        /// <returns></returns>
        Task<List<T>> getJoinList<T1, T2,T>(Expression<Func<T1, T2, JoinQueryInfos>> joinExp, Expression<Func<T1, T2, T>> selectExp, bool isWhere = false, Expression<Func<T1, T2, bool>> whereExp = null);
    }
}
